import { HttpUrlVariable } from '@/constants'
import type {
  CreateOrderResult,
  DepAll,
  OrderParams,
  OrderPreData,
  OrderPreParams,
  PayParams,
  PayResult,
} from '@/types/consult'
import RequestHttp from '@/utils/request'

export const getDepALLAPI = () => RequestHttp.get<DepAll[]>(HttpUrlVariable.DEP_ALL_URL)

/**
 * 获取预订单信息
 * **/
export const getPreOrderAPI = (params: OrderPreParams) =>
  RequestHttp.get<OrderPreData, OrderPreParams>(HttpUrlVariable.PRE_ORDER_URL, params)

/**
 * 创建订单接口
 * **/
export const createOrderAPI = (data: OrderParams) =>
  RequestHttp.post<CreateOrderResult, OrderParams>(HttpUrlVariable.CREATE_ORDER_URL, data)

/***
 * 支付接口-只支持支付宝
 * **/
export const payAPI = (data: PayParams) =>
  RequestHttp.post<PayResult, PayParams>(HttpUrlVariable.PAY_URL, data)
